﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using FRL.DebtChased.Repository.PartModels;

namespace WebApplication.Finance
{

	/// <summary>
	/// Declaration of CommissionChart
	/// </summary>
	public partial class CommissionChart : System.Web.UI.Page
	{

		/////////////////////////////////////////////////////////////
		// Attributes

		private CommissionChartModel m_model = null;
		public CommissionChartModel Model
		{
			get { return m_model; }
		}

		/////////////////////////////////////////////////////////////
		// Event handlers

		protected void Page_Load(object sender, EventArgs e)
		{

			// If this is a postback...
			if (this.IsPostBack)
			{

			}
			else
			{

				// Bind the grid view
				/*
				SqlDataRepository rep = new SqlDataRepository();
				m_model = rep.LoadCommissionChartModel();
				gridView.RowDataBound += new GridViewRowEventHandler(GridView_RowDataBound);
				gridView.DataSource = m_model.Managers;
				gridView.DataBind();
				 */

			}

		}

		void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
		{

			// If this is a data-row...
			if (e.Row.RowType == DataControlRowType.DataRow)
			{

				// Get the manager object
				CommissionChartModel.Manager manager = e.Row.DataItem as CommissionChartModel.Manager;

				// Get the grid-view and bind to the transaction
				GridView gridUsers = e.Row.FindControl("gridUsers") as GridView;
				gridUsers.DataSource = manager.Collectors;
				gridUsers.DataBind();

			}

		}

	}

}